using Cookbook.Common;

namespace Cookbook.Services.Core.ExceptionHandling
{
    /// <summary>
    /// Represents a thread-specific collection of multiple rule violations.
    /// </summary>
    public interface IViolationCollection
    {
        /// <summary>
        /// Adds the specified rule as a violation to the collection.
        /// </summary>
        void Add(Rule violatedRule);

        /// <summary>
        /// Adds the specified violation to the collection.
        /// </summary>
        void Add(Violation violation);

        /// <summary>
        /// If the collection contains any violation, it will throw a <see cref="RuleViolationException"/>
        /// containing all those violations.
        /// </summary>
        void ThrowIfAny();
    }
}